import type { PostPatientConsultOrderParams } from '@/types/common'
import { defineStore } from 'pinia'
import { ref } from 'vue'
export type IllnessInfoType = Pick<
  PostPatientConsultOrderParams,
  'illnessDesc' | 'illnessTime' | 'consultFlag' | 'pictures'
>
export const useConsultStore = defineStore(
  'consult',
  () => {
    // 初始化参数
    const initalValue: IllnessInfoType = {
      illnessDesc: '',
      illnessTime: 2,
      consultFlag: 1,
      pictures: [],
    }
    // 病情描述
    const illnessInfo = ref<IllnessInfoType>({ ...initalValue })

    // 问诊类型，医院类型，科室id
    const type = ref('')
    const illnessType = ref('')
    const depId = ref('')
    // 患者id
    const patientId = ref('')
    // 清空参数
    const clear = () => {
      illnessInfo.value = { ...initalValue }
      type.value = ''
      illnessType.value = ''
      depId.value = ''
      patientId.value = ''
    }
    return {
      illnessInfo,
      type,
      illnessType,
      depId,
      patientId,
      clear,
    }
  },
  {
    persist: true,
  }
)
